package com.gopay.scheduler.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.riskcontrol.RcListing;
import com.gopay.scheduler.dao.RcListingRemoveDuplicateDAO;

/** 
 * @ClassName: RcListingRemoveDuplicateDAOImpl 
 * @Description: 去重实现DAO 
 * @author liuyu 
 * @date 2016年11月18日 下午3:25:23  
 */
@SuppressWarnings("all")
@Repository("rcListingRemoveDuplicateDAO")
public class RcListingRemoveDuplicateDAOImpl extends BaseDAOImpl<RcListing, Long> implements RcListingRemoveDuplicateDAO {

    public List<Object[]> findAndGroupBy(final String sql){
        return (List<Object[]>) getHibernateTemplate().execute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException, SQLException {
                return session.createSQLQuery(sql).list();
            }
        });
    }
}
